
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>ICE HOCKEY MANAGER - Edit Club</title>
            <link rel="stylesheet" href="graphics/style.css" media="screen" />
        </head>
        <body>

            <div id="head">
                <h1><h:outputText value="Ice Hockey Manager"/></h1>
            </div>

            <h:form>
                <div id="top-panel">
                    <h:outputText value="#{msgs.logged_in_as}: #{manager.loginName} " />
                    <h:outputText value="(#{msgs.chosen_club}: #{manager.currentClub.name}) " rendered="#{manager.hasClub}" />
                    <h:commandButton value="#{msgs.logout}" action="#{manager.logout}" />
                </div>

                <ul id="menu">
                    <li>
                        <h:commandLink action="#{manager.editTeam}" value="#{msgs.my_team}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.browseOtherTeams}" value="#{msgs.other_teams}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editOffers}" value="#{msgs.offers}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editClub}" value="#{msgs.edit}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editPassword}" value="#{msgs.change_pass}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.clubsList}" value="#{msgs.clubsList}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createClub}" value="#{msgs.createNewClub}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createLeague}" value="#{msgs.createNewLeague}" rendered="#{manager.isAdmin}" />
                    </li>
                </ul>

            </h:form>

            <div id="content">
                <div id="in">
                    <h:form rendered="#{manager.hasClub}">
                        <h2><h:outputText value="#{msgs.editClub}"/></h2>
                        <h:panelGrid columns="3">
                            <h:outputText value="#{msgs.clubName}: " />
                            <h:inputText id="club_name" value="#{manager.clubName}" required="true" requiredMessage="#{msgs.club_name_required}">
                                <f:validator validatorId="ClubNameValidator"/>
                            </h:inputText>
                            <h:outputText value="(#{msgs.moneyOnAccount}: #{manager.club.account} Kč)" />
                            <h:outputText value="#{msgs.stadiumName}: " />
                            <h:inputText value="#{manager.stadiumName}"  required="true" requiredMessage="#{msgs.stadium_name_required}">
                                <f:validator validatorId="StadiumNameValidator"/>
                            </h:inputText>
                            <h:outputText value="(#{msgs.currentCapacity}: #{manager.club.stadium.capacity} #{msgs.spectators})" />
                        </h:panelGrid>
                        <h:commandButton action="#{manager.changeClub}" value="#{msgs.save}"/>

                        <h:messages />

                        </h:form>
                        <h:form rendered="#{manager.hasClub}">

                        <p>
                            <h:outputText value="#{msgs.increaseCapacity} "/>
                            <h:inputText value="#{manager.newSeats}"  required="true" requiredMessage="#{msgs.seat_count_required}" style="text-align: right;" size="10">
                                <f:validator validatorId="PositiveIntValidator"/>
                            </h:inputText>
                            <h:commandButton action="#{manager.increaseCapacity}" value="#{msgs.increase}"/>
                            <h:outputText value="(#{manager.seatCost} Kč/#{msgs.seat})"/>
                        </p>

                        </h:form>
                        <h:form rendered="#{manager.hasClub}">

                        <p>
                            <h:outputText value="#{msgs.currentEqLevel}: #{manager.club.stadium.equipmentLevel}"/>
                            <h:commandButton action="#{manager.improveEquipment}" value="#{msgs.improve}"/>
                            <h:outputText value="(#{manager.improvementCost} Kč)"/>
                        </p>
                    </h:form>

                    <h:form rendered="#{not manager.hasClub}">
                        <h:outputText value="#{msgs.createYourClub} "/>
                        <h:commandLink action="#{manager.createClub}" value="#{msgs.here}" />
                    </h:form>
                </div>
            </div>
            <div class="clr" />
        </body>
    </html>
</f:view>
